package com.pattern.design.designpattern.Status;

import com.pattern.design.designpattern.MainActivity;

/**
 * author:harisucici on 2018/10/9 17:50
 * email:harisucici@gmail.com
 * name:
 * todo:
 */
public class TvController implements PowerController {
    private TvState tvState;

    /**
     * Sets tv state.
     *
     * @param tvState the tv state
     */
    public void setTvState(TvState tvState) {
        this.tvState = tvState;
    }

    @Override
    public void powerOn() {
        setTvState(new PowerOnState());
        MainActivity.systemOut("on");
    }

    @Override
    public void powerOff() {
        setTvState(new PowerOffState());
        MainActivity.systemOut("off");

    }

    /**
     * Next channel.
     */
    public void nextChannel(){
        tvState.next();
    }

    /**
     * Prev channel.
     */
    public void prevChannel(){
        tvState.prev();
    }

    /**
     * Turn up.
     */
    public void turnUp(){
        tvState.up();
    }

    /**
     * Turn down.
     */
    public void turnDown(){
        tvState.down();
    }
}
